package com.baichang.taoshunda.controller;

import com.baichang.framework.controller.IPageController;
import com.baichang.framework.controller.WebBaseController;
import com.baichang.framework.excelption.ServiceException;
import com.baichang.framework.model.Page;
import com.baichang.taoshunda.ControllerConstants;
import com.baichang.taoshunda.service.IncidentalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Created by Administrator on 2018/3/22 0022.
 */
@Controller
@RequestMapping(ControllerConstants.VIDEO)
public class VideoWController extends WebBaseController {

    @Autowired
    private IncidentalService incidentalService;

    /**
     * @return
     */
    @RequestMapping("/findVideo")
    public String findVideo() {
        return "taoshunda/material/video";
    }

    /**
     * @param request
     * @param response
     */
    @RequestMapping("/queryVideo")
    public void queryVideo(final HttpServletRequest request, HttpServletResponse response) {
        initPage(request, response, new IPageController() {
            @Override
            public Page initPage(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws ServiceException {
                Integer type = getInt(request, "type", 0);
                return incidentalService.queryVideo(type, nowPage, pageSize);
            }
        });
    }
}
